import { memo } from 'react';
import { useShallow } from 'zustand/react/shallow';
import useUserStore from '@/store/user';
import { Button } from 'antd';

export const Login = memo(() => {
  const { name, changeName } = useUserStore(
    useShallow((state) => ({ name: state.name, changeName: state.changeName })),
  );
  return (
    <div>
      <h1>登录</h1>
      <span>{name}</span>
      <Button onClick={changeName} type="primary">
        changeName
      </Button>
    </div>
  );
});
